#include <iostream>
#include <cstring>
using namespace std;
class String
{
private:
    char *s;
    int len;

public:
    String(char *t = NULL)
    {
        if (t == NULL)
        {
            s = new char('\0');
            len = 1;
        }
        else
        {
            s = new char[len = strlen(t) + 1];
            strcpy(s, t);
        }
    }
    ~String() { delete[] s; }
    char &operator[](int i);
    String &operator=(const String &a);
    friend String operator+(const String &a, const String &b);
    friend ostream &operator<<(ostream &out, const String &a);
    friend istream &operator>>(istream &in, String &a);
};

int main()
{
    String a, b, c;
    int x;
    while (cin >> a >> b >> x)
    {
        getchar();
        c = a;
        cout << "testing =: " << c << endl;
        c = a + b;
        cout << "testing +: " << c << endl;
        cout << "testing []: " << c[x] << endl;
    }
    return 0;
}

char &String::operator[](int i)
{
    return this->s[i];
}
String &String::operator=(const String &a)
{
    if (this == &a)
        return *this;

    delete[] s;

    s = new char[strlen(a.s) + 1];
    strcpy(s, a.s);
    this->len = a.len;
    return *this;
}
String operator+(const String &a, const String &b)
{
    char *st = new char[strlen(a.s) + strlen(b.s) + 1];
    strcpy(st, a.s);
    strcat(st, b.s);
    String tmp(st);
    delete[] st;
    return tmp;
}
ostream &operator<<(ostream &out, const String &a)
{
    out << a.s;
    return out;
}
istream &operator>>(istream &in, String &a)
{
    a.s = new char[1000];
    cin.getline(a.s, 1000);
    a.len = strlen(a.s) + 1;
    return in;

    return in;
}